<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<title>店+发券管理</title>
		<link rel="stylesheet" href="css/reset.css" />
        <link rel="stylesheet" href="css/table.css" />
        <link rel="stylesheet" href="css/platform.css"/>
        <link rel="stylesheet" href="js/ui/jquery-ui.min.css"/>
        <link rel="stylesheet" href="css/page/sendCoupon.css"/>
	</head>
	<body ms-controller="coupon">
	    <div ms-visible="!historyShow">
            <p class="u-title">发券管理</p>
            <div class="u-multiform">
                <div class="column">
                    <div class="cell">
                        <label>活动名称：</label>
                        <input class="u-ipt" ms-duplex="sActivityName">
                    </div>
                    <div class="cell">
                        <label>活动时间：</label>
                        <div class="cnt-box">
                            <input class="u-ipt ipt-timepicker" type="text" id="timepickerStart" placeholder="开始时间" ms-duplex="sStartTime">
                            <span class="split">-</span>
                            <input class="u-ipt ipt-timepicker" type="text" id="timepickerEnd" placeholder="结束时间" ms-duplex="sEndTime">
                        </div>
                    </div>
                </div>
                <div class="column btn-box">
                    <div class="cell">
                        <label></label>
                        <div class="cnt-box">
                            <button class="u-btn small" ms-click="search">查询</button>
                        </div>
                    </div>
                </div>
            </div>
            <div calss="tableContent">
                <div id="couponTb" ms-controller="couponTb"></div>
            </div>
        </div>
        <div ms-visible="historyShow">
            <p class="u-title">导入记录</p>
            <div class="u-datainfo">
                <div class="column">
                    <div class="cell">
                        <label>活动名称：</label>
                        <p class="cnt-box">{{activityName}}</p>
                    </div>
                </div>
                <div class="column">
                    <div class="cell">
                        <label>已导入券数量：</label>
                        <p class="cnt-box">{{actCount}}</p>
                    </div>
                    <div class="cell">
                        <label>剩余可导入券数量：</label>
                        <p class="cnt-box">{{dValue}}</p>
                    </div>
                    <div class="cell">
                        <label>已使用数量：</label>
                        <p class="cnt-box">{{hasSend}}</p>
                    </div>
                    <div class="cell">
                        <label>剩余券总数：</label>
                        <p class="cnt-box">{{remainActCount - hasSend}}</p>
                    </div>
                </div>
            </div>
            <div class="u-topBtnBox">
                <button type="button" class="u-btn small" ms-visible="dValue != 0" ms-click="exportData">导入</button>
            </div>
            <div calss="tableContent">
                <div id="historyTb" ms-controller="historyTb"></div>
            </div>
            <div class="u-bottomBtnBox">
                <button type="button" class="u-btn gray" ms-click="back">返回</button>
            </div>
        </div>
        
        <div class="u-popup" ms-visible="popup.export">
            <div class="bg"></div>
            <div class="asTable">
                <div class="asTableCell">
                    <div class="asCell dialog">
                        <a href="javascript:;" class="close" ms-click="popup.close">×</a>
                        <p class="title">选择导入文件</p>
                        <div class="container">
                            <form id="form_uploadFile" enctype="multipart/form-data" method="post">
                                <input type="hidden" name="actRemainCount" ms-duplex="remainActCount" />
                                <input type="hidden" name="activityName" ms-duplex="activityName" />
                                <input type="hidden" name="activitySecretKey" ms-duplex="activitySecretKey" />
                                <input type="hidden" name="endTime" ms-duplex="endTime" />
                                <input type="hidden" name="proActivityId" ms-duplex="proActivityId" />
                                <input type="hidden" name="proActivityName" ms-duplex="proActivityName" />
                                <input type="hidden" name="startTime" ms-duplex="startTime" />
                                <div class="file-ipt">
                                    <input type="file" name="importData" id="ipt-file" value="" accept="application/vnd.ms-excel,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
                                </div>
                            </form>
                        </div>
                        <div class="btn-box">
                            <button class="u-btn" type="button" ms-click="popup.exportSure">提交</button>
                            <button class="u-btn orange" type="button" ms-click="popup.close">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="u-headTip"><p></p></div>
        
        <div class="popup-loading" ms-visible="popup.loading">
            <div class="bg">
                <div class="loading-box">
                    <img src="img/loading.png" />
                    <p>{{popup.loadingTxt}}</p>
                </div>
            </div>
        </div>
        
        <div class="u-popup" ms-visible="popup.operate">
            <div class="bg"></div>
            <div class="asTable">
                <div class="asTableCell">
                    <div class="asCell alert">
                        <a href="javascript:;" class="close btn-close" ms-click="popup.close">×</a>
                        <p class="title">提示</p>
                        <div class="container">
                            <div class="warning"></div>
                            <p>确定要停用该活动吗？</p>
                        </div>
                        <div class="btn-box">
                            <button class="u-btn btn-close" ms-click="popup.operateSure">确定</button>
                            <button class="u-btn orange btn-close" type="button" ms-click="popup.close">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="u-popup" ms-visible="popup.del">
            <div class="bg"></div>
            <div class="asTable">
                <div class="asTableCell">
                    <div class="asCell alert">
                        <a href="javascript:;" class="close btn-close" ms-click="popup.close">×</a>
                        <p class="title">提示</p>
                        <div class="container">
                            <div class="warning"></div>
                            <p>确定要清空该数据么？</p>
                        </div>
                        <div class="btn-box">
                            <button class="u-btn btn-close" ms-click="popup.delSure">确定</button>
                            <button class="u-btn orange btn-close" type="button" ms-click="popup.close">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <script type="avalon" id="couponTbTemplate">
            <div class="tableWrapper">
                <table class="table">
                    <thead>
                        <tr>
                            <th>活动名称</th>
                            <th>活动编码</th>
                            <th>创建人</th>
                            <th>开始日期</th>
                            <th>结束日期</th>
                            <th>已发放</th>
                            <th>剩余券</th>
                            <th>总券量</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ms-repeat-row="sources">
                            <td>{{row.activityName}}</td>
                            <td>{{row.proActivityId}}</td>
                            <td>{{row.creator}}</td>
                            <td>{{row.startTime}}</td>
                            <td>{{row.endTime}}</td>
                            <td>{{row.hasSend}}</td>
                            <td>{{row.remainActCount - row.hasSend}}</td>
                            <td>{{row.remainActCount}}</td>
                            <td>{{row.isUsed | isUsed}}</td>
                            <td class="operate">
                                <a href="javascript:;" ms-click="customFuncs.operate(row)">{{row.isUsed | isUsedBtn}}</a>
                                <a href="javascript:;" ms-visible="row.status != 1 && row.status != 4" ms-click="customFuncs.create(row)">生成券</a>
                                <a href="javascript:;" ms-visible="row.dValue != 0 && (row.status == 0 || row.status == 4)" ms-click="customFuncs.exportData(row)">导入</a>
                                <a ms-attr-href="row.couponFileUrl" ms-visible="row.status == 1">导出</a>
                                <a href="javascript:;" ms-visible="row.status == 4" ms-click="customFuncs.exportHistory(row)">导入记录</a>
                            </td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="11">
                                <div class="pager">
                                    <div class="first-page" ms-click="firstpage" ms-class={{firstpagestyle}}>首页</div>
                                    <div class="pre-page" ms-click="prepage" ms-class={{prepagestyle}}>上一页</div>
                                    <div class="current-page">第<input class="current-page-num" type="text" ms-duplex="currentpage" ms-input="jumppage"/>页
                                        <span class="totalpage">共 {{totalpage}} 页</span>
                                    </div>
                                    <div class="next-page" ms-click="nextpage" ms-class={{nextpagestyle}}>下一页</div>
                                    <div class="last-page" ms-click="lastpage" ms-class={{lastpagestyle}}>尾页</div>
                                    <!--
									<div class="pageRowsConfig" ms-if="isshowRowsList"><span class="configTxt">每页</span><select class="rowsConfig" ms-duplex="peerpagerows" ms-change="refresh"><option ms-repeat-options="rowsConfigList">{{options}}</option></select> <span class="configTxt">行</span></div>
                                    <div class="messageinfo">{{startrow}}-{{endrow}} 共{{total}}条</div>
                                	-->
								</div>
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </script>
        <script type="avalon" id="historyTbTemplate">
            <div class="tableWrapper">
                <table class="table">
                    <thead>
                        <tr>
                            <th>导入数量</th>
                            <th>导入文件名称</th>
                            <th>操作人工号</th>
                            <th>操作时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ms-repeat-row="sources">
                            <td>{{row.importNum}}</td>
                            <td>{{row.fileName}}</td>
                            <td>{{row.operator}}</td>
                            <td>{{row.operateTime}}</td>
                            <td class="operate">
                                <a href="javascript:;" ms-click="customFuncs.del(row)">清空</a>
                            </td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="11">
                                <div class="pager">
                                    <div class="first-page" ms-click="firstpage" ms-class={{firstpagestyle}}>首页</div>
                                    <div class="pre-page" ms-click="prepage" ms-class={{prepagestyle}}>上一页</div>
                                    <div class="current-page">第<input class="current-page-num" type="text" ms-duplex="currentpage" ms-input="jumppage"/>页
                                        <span class="totalpage">共 {{totalpage}} 页</span>
                                    </div>
                                    <div class="next-page" ms-click="nextpage" ms-class={{nextpagestyle}}>下一页</div>
                                    <div class="last-page" ms-click="lastpage" ms-class={{lastpagestyle}}>尾页</div>
                                    <div class="pageRowsConfig" ms-if="isshowRowsList"><span class="configTxt">每页</span><select class="rowsConfig" ms-duplex="peerpagerows" ms-change="refresh"><option ms-repeat-options="rowsConfigList">{{options}}</option></select> <span class="configTxt">行</span></div>
                                    <div class="messageinfo">{{startrow}}-{{endrow}} 共{{total}}条</div>
                                </div>
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </script>
        
        <script src="oldjs/jquery.min.js"></script>
        <script src="oldjs/avalon.shim.sn.js"></script>
        <script src="oldjs/ui/jquery-ui.min.js"></script>
        <script src="oldjs/ui/jquery-ui-timepicker-addon.js"></script>
        <script src="oldjs/jquery.form.js"></script>
        <script src="oldjs/swift-ui-table-1.1.js"></script>
        <script src="oldjs/platform.js"></script>
        <script src="js/DataInterface/DataInterface.js"></script>
        <script src="js/page/sendCoupon.js"></script>
	</body>
</html>
